﻿	#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Weazel.Math;

#endregion

namespace Weazel.Math.Test
{
  [TestClass]
  public class TestNegate
  {
    [TestMethod]
    public void TestNegateWidthMismatch()
    {
      Integer a = new Integer(32, 0x3, true);
      Integer r = new Integer(16, true);

      try
      {
        Integer.Negate(ref r, a);
        Assert.Fail();
      }
      catch (WidthMismatchException)
      {
      }
    }

    [TestMethod]
    public void TestNegateOk()
    {
      Integer a = new Integer(32, -1, true);
      Integer r = new Integer(32, true);

      Integer.Negate(ref r, a);
      Assert.AreEqual("1", r.ToDecimalString());
    }
  }
}
